#{extends 'main.html' /}
#{set title:'Review Log' /}

#{set 'moreScripts'}

<!--@author: Hossam Amer
used to show and edit the meetings that do have a review log-->
<!--@author: menna.ghoneim  -->
<!-- issue 31 fixing permissions -->
#{if u.in(p).can(editNoteReviewLog)}
<script language="javascript" type="text/javascript" src="@{'/public/javascripts/jeditable-mod.js'}"></script>

<script type="text/javascript">

 $(function()
 {      
    $('.editDES').editable(
    	    function(value)
    	    {
    	        var noteId 	= parseInt($('#lolid').closest("td").attr("id"));
				
				$.post('@{ReviewLog.editNote()}',
    	    	       {id:noteId, des: value}
					  );
			   
        	    return(value);
    	        
    	    },
    	    {    
    	        indicator : 'Saving...',
    	        tooltip   : 'Click to edit...'
    	    });
			
			 $('.editTaskDES').editable(
    	    function(value)
    	    {
    	        var taskId 	= parseInt($('#lolid').closest("td").attr("id"));
    	       
    	        $.post('@{Tasks.editTaskDesc()}',
    	            {id:taskId, desc:value});

        	    return(value);
    	        
    	    },
    	    {    
    	        indicator : 'Saving...',
    	        tooltip   : 'Click to edit...'
    	    });





  });

</script>
#{/if}

<script language="javascript" type="text/javascript">
$(function()
	{
	$(document).ready(function() {
	    $("#accor").accordion(
		{
			autoHeight: false,

			
		});
	  });
	});
</script>

#{/set}

<!--@author Hossam Amer
Shows the list of meetings  for the scrum master-->

#{if pExist}
	<h2> ${p.name} Meetings:</h2>
#{/if}

#{else}
	<h2> Project Meetings:</h2>
#{/else}

<br>

#{if directLink}
	<div id="NOTE"style="padding: 10px 10px 10px 10px" class="ui-state-highlight ui-corner-all"> 
	<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
	<strong>NOTE: </strong>Access Denied, You should select a Project first.
</div>

#{/if}

#{else}

#{ifnot reviewMeetings}
	<div id="NOTE"style="padding: 10px 10px 10px 10px" class="ui-state-highlight ui-corner-all"> 
	<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
	<strong>NOTE: </strong>There are no meetings available to be displayed.
</div>
	
#{/ifnot}

#{else}

<div id= "accor" >
#{list items:reviewMeetings, as:'meeting'}

<h6><a>${meeting.name}</a></h6>

<div>
	<h3>The Artifact(s), Attendee(s), and Task(s) for ${meeting.name} of type ${meeting.type} are:</h3>
		
		#{ifnot meeting.hasNotes()}
			<div id="NOTE"style="padding: 10px 10px 10px 10px" class="ui-state-highlight ui-corner-all"> 
	<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
	<strong>NOTE: </strong>There are no notes for the ${meeting.name} Meeting</div>
		#{/ifnot}
		
		#{else}
		<h3> Notes associated with ${meeting.name} Meeting:</h3> <br>
		<table border = "1">
			<tbody>
				<thead>
					<td>Note Description</td>
				</thead>
				
					#{list items:meeting.getArtifactOfTypeNotes(), as:'note'}
						
					#{if note.checkType()}			
					<tr>
									
							<td title="edit the description?"  id="${note.id}" class="editDES">
							${note.description}
						   </td>
						   									
					</tr>
								
					#{/if}		
						
					#{/list}
			</tbody>
			</table>
				
		#{/else}

<br>

		#{ifnot meeting.tasks}
		<div id="NOTE"style="padding: 10px 10px 10px 10px" class="ui-state-highlight ui-corner-all"> 
	<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
	<strong>NOTE: </strong>There are no tasks for the ${meeting.name} Meeting</div>
		#{/ifnot}
		
		#{else}
	<h3> Tasks associated with ${meeting.name} Meeting:</h3> <br>	
	<table border = "1">
	<tbody>
		<thead>
			<td>Task Description</td>
		</thead>
			#{list items:meeting.tasks, as:'task'}		
				<tr>				
						<td title="edit the description?"  id="${task.id}" class="editTaskDES">
							${task.description}
						</td>																		
				</tr>					
				
			#{/list}
	</tbody>
	</table>
	#{/else}	
<br>
	
		#{ifnot meeting.hasAttendees()}
			<div id="NOTE"style="padding: 10px 10px 10px 10px" class="ui-state-highlight ui-corner-all"> 
	<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
	<strong>NOTE: </strong>There are no attendees for the ${meeting.name} Meeting</div>
		#{/ifnot}		
	#{else}
	<h3> Attending Developers in ${meeting.name} Meeting:</h3> <br>
	
	<table border = "1">
	<tbody>
		<thead>
			<td>User Name</td>
		</thead>
		
			#{list items:meeting.users, as:'user'}
				
				<tr>
				
				<td>
		     	${user.user.name} : 
    			</td>
				
				#{if user.checkConfirmed()}											
								
				Attended.		
						
				#{/if}	
				
				#{else}
				
				Did not attend.
				
				#{/else}
				
				</tr>									
			#{/list}
</tbody>
</table>

#{/else}
</div>	
#{/list}
</div>

#{set 'moreLinks'}
	#{list items:reviewMeetings, as:'meeting'}
			<a href="@{Meetings.viewMeeting(meeting.id) }">${meeting.name}</a>
			<br>
	#{/list}
#{/set}

<br></br>

#{/else}
#{/else}

#{set 'crumbs'}

	<li><a href = "@{Show.projects()}"> Projects</a></li>
	
	#{if pExist}
		<li><a href="@{Show.project (projectID)}">${p.name}</a></li>
		<li><a href="@{Sprints.showsprints(projectID)}}">Sprints</a></li>
		#{if sExist}
			<li><a href="@{Sprints.showsprint(sid,projectID)}">Sprint ${sid}</a></li>
		#{/if}
	#{/if}
	
	#{if cExist}
		<li><a href="@{SprintBacklog.index(cid, sid)}">${c.name} sprint backlog</a></li>
	#{/if}
	
		
		#{if pExist}
			<li><a href="@{ReviewLog.showMeetings(projectID, cid, sid)}" name = "showMeetings" >${p.name}'s Review Logs</a></li>
		#{/if}
		#{else}
			<li><a href="@{ReviewLog.showMeetings(projectID, cid, sid)}" name = "showMeetings" >Display the Review Log</a></li>
		#{/else}
#{/set}
